#!/usr/bin/perl -w

use strict;

$main::verbose = 1;

my ($prog,$progdir);
BEGIN {
    $0 =~ m{(.*)/(.*?)};
    ($progdir,$prog) = ($1,$2);
    $progdir = '.' unless $progdir;
    #print "$progdir\n";
    push @INC, "$progdir/lib", "$progdir";
    #print join(':',@INC),"\n";
}

use XNAT::Connection;

print "XNAT::Test Creating Connection:\n";
my $xconn = XNAT::Connection->new(host=>'gspcentral');
print "XNAT::Test OK\n";


if(@ARGV) {
  foreach my $session_id (@ARGV) {
    # $xconn->getFCScanList({id=>$session_id});
    $xconn->getFCScans({id=>$session_id});
  }
} else {
  my @sessions = $xconn->getAllSessionIDs();
  my $count = 0;
  foreach my $session_id (@sessions) {
    $count++;
    $xconn->getFCScanList({id=>$session_id});
    #last if $count > 35;
  }
  die "Usage: $0 session_id [session_id] ...\n" unless @ARGV;
}

exit;
__END__
'090801_JJ47YK');
exit;
#$xconn->getBriefSessionInfo('090801_JJ47YK');
print "XNAT::Test Calling \$xconn->getSession(id=>'090801_JJ47YK',scans=>'LOCALIZER'); :\n";
$xconn->getSession(id=>'090801_JJ47YK',scans=>'LOCALIZER');
print "XNAT::Test OK:\n";

#$xconn->getSessionInfo('090731_DQ57HH');
#$xconn->getBriefSessionInfo('090731_DQ57HH');
$xconn->getSession(id=>'090731_DQ57HH',scans=>'1,7');

#$xconn->getSessionInfo('090722_KC42JU');
#$xconn->getBriefSessionInfo('090722_KC42JU');
$xconn->getSession(id=>'090722_KC42JU',scans=>'LOCALIZER,7');
